package com.yixun.qfbao.hander;

import com.yixun.qfbao.api.service.SmsHistoryApiService;
import com.yixun.qfbao.apidto.MarketingSmsAsyncReqDto;
import com.yixun.qfbao.apidto.MarketingSmsAsyncResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.MarketingSmsAsyncReqVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("marketingSmsAsyncHander")
public class MarketingSmsAsyncHander extends CommonAbstractHander {
    private static Logger logger= LoggerFactory.getLogger(MarketingSmsAsyncHander.class);

    @Autowired
    private SmsHistoryApiService smsHistoryApiService;
    @Override
    public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
        MarketingSmsAsyncReqVo req = (MarketingSmsAsyncReqVo)reqDto;
        MarketingSmsAsyncReqDto reqDto1 = req.getParams();
        BaseResponseDTO<MarketingSmsAsyncResDto> res = new BaseResponseDTO<MarketingSmsAsyncResDto>();
        MarketingSmsAsyncResDto resDto = new MarketingSmsAsyncResDto();

        try{
            resDto = smsHistoryApiService.marketingSmsAsync(reqDto1);
            res.setResult(resDto.getResult());
        }catch (Exception e){
            logger.error("marketingSmsAsyncHander error: {}", e);
            res.setResult(resDto.getResult());
        }
        return res;
    }
}
